package org.nanfang.test11;

public class ProgressThrad extends Thread{
    /**
     * 拷贝文件的状态
     */
    private FileDate fileData;

    public ProgressThrad() {

    }

    public ProgressThrad(FileDate fileData) {
        this.fileData = fileData;
    }

    @Override
    public void run() {

        while (true) {
            if (this.fileData.getTotalSize() == 0) {
                continue;
            }
            double percent = this.fileData.getCopiedSize() * 1.0 / this.fileData.getTotalSize() * 100;
            System.out.printf("完成进度：%.2f %% %n",percent);

            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }


    }
}
